﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login2.aspx.cs" Inherits="Liu_Project.Web.Admin.Login2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台登录</title>
    <script src="../boot.js"></script>
    <link href="css/login.css" rel="stylesheet" />
</head>
<body style="background-image: url(images/back_03.jpg)">
    <form class="layui-form">
        <div class="doc">
            <div style="background-color: #242422;">
                <%--padding: 20px;--%>
                <div class="b_l_w" style="text-align: center;">
                    <img src="images/logo_1.png" />
                </div>
                <div class="b_l_w" style="margin-top: 20px;">
                    <div class="ipt">
                        <table>
                            <tr>
                                <td style="width: 65px; padding-left: 5px;">
                                    <img src="images/d_r2_c2.jpg" /></td>
                                <td>
                                    <input type="text" name="txtUser" lay-verify="required" autocomplete="off" lay-vertype="tips" lay-reqtext="账号不能为空" placeholder="请输入账号" class="layui-input" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="b_l_w" style="margin-top: 10px;">
                    <div class="ipt">
                        <table>
                            <tr>
                                <td style="width: 65px; padding-left: 5px;">
                                    <img src="images/d_r4_c2.jpg" /></td>
                                <td>
                                    <input type="password" name="txtPwd" lay-verify="required" lay-vertype="tips" lay-reqtext="密码不能为空" placeholder="请输入密码" autocomplete="off" class="layui-input" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="b_l_w" style="margin-top: 10px;">
                    <div class="ipt">
                        <table>
                            <tr>
                                <td style="width: 65px; padding-left: 5px;">
                                    <img src="images/d_r6_c2.jpg" /></td>
                                <td>
                                    <input type="text" name="txtValidate" lay-verify="required" lay-vertype="tips" lay-reqtext="验证码不能为空" autocomplete="off" placeholder="请输入验证码" class="layui-input" />
                                </td>
                                <td style="padding-right: 10px; width: 90px; text-align: right;">
                                    <img id="Validate" src="Image.aspx" onclick="this.src='Image.aspx?id='+Math.random()" title="点击刷新验证码" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="b_l_w" style="margin-top: 10px;">
                    <button type="submit" id="btnSignIn" class="bt" lay-submit="" lay-filter="SignIn">登录</button>
                </div>
            </div>
        </div>
    </form>
</body>
</html>

<script>
    ; !function () {
        $ = layui.$;
        var form = layui.form;

        form.on('submit(SignIn)', function (data) {
            $('#btnSignIn').text("正在登录...");
            $('#btnSignIn').addClass('layui-btn-disabled').attr('disabled', true);
            var index = layer.msg('正在登录...', { icon: 16, shade: 0.5 });
            $.getJSON("Handler/LoginHand.ashx", { "method": "Login", "txtuserNo": data.field.txtUser, "txtuserPwd": data.field.txtPwd, "txtvalidate": data.field.txtValidate }, function (data) {
                layer.close(index);
                if (!data.IsSuccess) {
                    layer.msg(data.msg, { time: 1000 }, function () {
                        layer.close(index);
                        $('#btnSignIn').text("登录");
                        $('#btnSignIn').removeClass('layui-btn-disabled').attr('disabled', false);
                    });
                    //弹窗
                    //layer.open({
                    //    title: '提示', closeBtn: 0, shade: 0.5, btnAlign: 'c',
                    //    content: '<div style="padding: 10px 100px;text-align: center;">' + data.msg + '</div>',
                    //    yes: function (index, layero) {
                    //        layer.close(index); //如果设定了yes回调，需进行手工关闭
                    //        $('#btnSignIn').removeClass('layui-btn-disabled').attr('disabled', false);
                    //    }
                    //});
                    return;
                }
                else {
                    layer.msg('登录成功，正在跳转...', { icon: 6, time: 100 }, function () {
                        location.replace("Pages/Home/Main.aspx");
                    });
                }
            })

            return false;
        });

    }();
</script>
